package com.romadan.core.nonlinearanalys.fet.volterra.logic;

import java.util.ArrayList;
import java.util.List;

import com.romadan.utils.math.Complex;

public class EdgeType {
	@SuppressWarnings("serial")
	private List<String> types = new ArrayList<String>(){
		{
			add("R");
			add("L");
			add("C");
			add("G");
			add("IV");
			}
		};
	private int edge_id;
	private NodeType a_node;
	private NodeType z_node;
	private String type;
	private double value;
	private EdgeType run_edge;
	private Complex e_source;
	private Complex i_source;
	private Complex voltage;
	private Complex current;
	
	public EdgeType(int edge_id) {
		this.edge_id = edge_id;
		run_edge = this;
	}
	
	public EdgeType(int edge_id, NodeType a_node, NodeType z_node, String type) {
		this.edge_id = edge_id;
		this.a_node = a_node;
		this.z_node = z_node;
		this.type = type;
		this.e_source = Complex.ZERO;
		this.i_source = Complex.ZERO;
	}
	
	public EdgeType(List<String> types, String type, double value, int edge_id,
			NodeType a_node, NodeType z_node, EdgeType run_edge,
			Complex e_source, Complex i_source) {
		super();
		this.types = types;
		this.type = type;
		this.value = value;
		this.edge_id = edge_id;
		this.a_node = a_node;
		this.z_node = z_node;
		this.run_edge = run_edge;
		this.e_source = e_source;
		this.i_source = i_source;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public double getValue() {
		return value;
	}

	public void setValue(double value) {
		this.value = value;
	}

	public List<String> getTypes() {
		return types;
	}

	public NodeType getA_node() {
		return a_node;
	}

	public void setA_node(NodeType a_node) {
		this.a_node = a_node;
	}

	public NodeType getZ_node() {
		return z_node;
	}

	public void setZ_node(NodeType z_node) {
		this.z_node = z_node;
	}

	public EdgeType getRun_edge() {
		return run_edge;
	}

	public void setRun_edge(EdgeType run_edge) {
		this.run_edge = run_edge;
	}

	public Complex getE_source() {
		return e_source;
	}

	public void setE_source(Complex e_source) {
		this.e_source = e_source;
	}

	public Complex getI_source() {
		return i_source;
	}

	public void setI_source(Complex i_source) {
		this.i_source = i_source;
	}

	public int getId() {
		return edge_id;
	}

	public Complex getVoltage() {
		return voltage;
	}

	public void setVoltage(Complex voltage) {
		this.voltage = voltage;
	}

	public Complex getCurrent() {
		return current;
	}

	public void setCurrent(Complex current) {
		this.current = current;
	}

	@Override
	public String toString() {
		return "EdgeType [id=" + edge_id + ", a_node=" + a_node
				+ ", z_node=" + z_node + ", type=" + type + ", value=" + value
				+ ", run_edge=" + run_edge + ", e_source=" + e_source
				+ ", i_source=" + i_source + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + edge_id;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		EdgeType other = (EdgeType) obj;
		if (edge_id != other.edge_id)
			return false;
		return true;
	}
}
